package mlz.b_class;

/*
    获取类的字节码对象
 */
public class StudentClassDemo {
    public static void main(String[] args) throws ClassNotFoundException {
        //方式一:
        Class c1 = Student.class;
        System.out.println(c1.getName());//获取全类名
        System.out.println(c1.getSimpleName());//简单类名

        //方式二: 手动加载全限定类名
        Class c2 = Class.forName("mlz.b_class.Student");
        System.out.println(c2);
        System.out.println(c1 == c2);

        //方式三: new对象
        Student stu = new Student();
        Class c3 = stu.getClass();
        System.out.println(c3);
        System.out.println(c1 == c3);

    }
}










